PowerTCP Mail for .NET
MailMessage Constructor(String,String,FileInfo[],List<Attachment>)




Used to initialize Multipart.Text (Parts[0]). If null or empty no Textpart is created.
Used to initialize Multipart.Html (Parts[1]). If null or empty an ArgumentNullException is thrown.
Used to initialize a "multipart/related" part (Parts[1]) that provides linked embedded resources referenced by Multipart.Html. If null an Htmlpart is created instead.
Used to initialize the attachments collection for this part. If null no attachments will be added.
Initializes Parts with new Textpart, Htmlpart and linked Resource parts.
Syntax
Public Function New( _
   ByVal text As String, _
   ByVal html As String, _
   ByVal htmlResources() As FileInfo, _
   ByVal attachments As List(Of Attachment) _
)
Dim text As String
Dim html As String
Dim htmlResources() As FileInfo
Dim attachments As List(Of Attachment)
 
Dim instance As New MailMessage(text, html, htmlResources, attachments)
public MailMessage( 
   string text,
   string html,
   FileInfo[] htmlResources,
   List<Attachment> attachments
)
public: MailMessage( 
   string* text,
   string* html,
   FileInfo*[]* htmlResources,
   List<Attachment*>* attachments
)
public:
MailMessage( 
   String^ text,
   String^ html,
   array<FileInfo^>^ htmlResources,
   List<Attachment^>^ attachments
)

Parameters

text
Used to initialize Multipart.Text (Parts[0]). If null or empty no Textpart is created.
html
Used to initialize Multipart.Html (Parts[1]). If null or empty an ArgumentNullException is thrown.
htmlResources
Used to initialize a "multipart/related" part (Parts[1]) that provides linked embedded resources referenced by Multipart.Html. If null an Htmlpart is created instead.
attachments
Used to initialize the attachments collection for this part. If null no attachments will be added.
Exceptions
ExceptionDescription
System.ArgumentExceptionhtmlResources missing reference to an HTML link.
System.ArgumentNullExceptionhtml cannot be null or empty.
Remarks

This constructor is used to create an HTML email with attachments. multipart/alternative and/or multipart/related parts are created to represent the parameters provided.

This method will create an email where Part.ContentType is set to "multipart/mixed". If text is null or empty, then html and htmlResources are used to create either a text/html part or a mulipart/related part that contains a text/html part taht will be added to the multipart/mixed part. Otherwise, that part's Part.ContentType is set to "multipart/alternative" and 2 parts (text/plain, and a text/html or multipart/related) are created and saved in Parts.

If htmlResources is null, then html is represented as a single Htmlpart. Otherwise, a new "multipart/related" Multipart is created and initialized with html and linked htmlResources.

See Also

Reference

MailMessage Class
MailMessage Members
Overload List


PowerTCP Mail for .NET Documentation Version 4.3
© 2018 Dart Communications. All Rights Reserved.
Send comments on this topic